package com.it.common.exception;

import com.it.common.config.ResultBean;
import lombok.Getter;

/**
 * 自定义异常类
 */
@Getter
public class CustomException extends RuntimeException {

    /**
     * 错误码
     */
    private final String code;

    /**
     * 错误信息
     */
    private final String message;

    public CustomException(String code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public CustomException(ResultBean resultBean) {
        super(resultBean.description());
        this.code = resultBean.value();
        this.message = resultBean.description();
    }

    public CustomException(ResultBean resultBean, String message) {
        super(message);
        this.code = resultBean.value();
        this.message = message;
    }
} 